﻿#pragma once
////////////////////////////////////////////////////////////////
//
//		设备标定
//
//		2021-11-9
//
////////////////////////////////////////////////////////////////////

#include "HisChromG.h"
#include "IntegralResultWnd.h"
#include "BtnST.h"
// CCalibrateView 窗体视图
#define  WND_CALICHROMCURVE_ID		19400
#define  WND_CALIINTRESULT_ID			19401

class CCalibrateView : public CFormView
{
	DECLARE_DYNCREATE(CCalibrateView)

public:
	CCalibrateView();           // 动态创建所使用的受保护的构造函数
	virtual ~CCalibrateView();

private:
	int m_nCurIndex;
	int	m_nCh;				//通道
	double	m_dC[10];
	double	m_dArea[10];
	short	m_nS[10];
	bool	m_bModify;
	int		m_nCurID;
	double	m_dK;
	double	m_dB;
	double	m_dR;
	CButtonST				m_btKeyboard;

	void GetData();
	void SetData();

public:
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_CCalibrateView };
#endif
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif
	CHisChromG			m_wndCurve;
	CIntegralResultWnd	m_wndIntResult;
	CButton m_btUp;
	CButton m_btDown;
	CButton m_btOpen;

	//列表
private:
	int		m_nTimer;
	int		m_nOldCount;
	int	 m_nCurPartIndex;		//列表文件显示
	bool		m_bUpdateFormView;	//是否进行了刷新

	CRect   m_lstArea;
	CHROM_LIST ChromList[10];
	CRect		m_rtFile[10];
	CString		GetTimeFromFileName(CString strFileName);
	void	DrawChromList(CDC* pDC, CRect rt);

public:
	void	RefreshList();


private:
	CPoint	m_ptOrign;
	int		m_nWidth;
	int		m_nHeight;
	void	Draw(CDC* pDC, CRect rt);
	void	DrawCaliFrame(CDC* pDC, CRect rtArea);
	void	DrawCaliCurve(CDC* pDC, CRect rtArea);

public:
	void	RelayOut();

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	virtual void OnInitialUpdate();
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnBnClickedBttwochcali();
	afx_msg void OnBnClickedBtsort();
	afx_msg void OnBnClickedBtpre();
	afx_msg void OnBnClickedBtnext();
	afx_msg void OnBnClickedBtsave();
	afx_msg void OnBnClickedBtload();
	afx_msg void OnBnClickedBtsaveas();
	afx_msg void OnBnClickedBtexport();
	afx_msg void OnBnClickedBtintpar();
	afx_msg void OnBnClickedBtup();
	afx_msg void OnBnClickedBtdown();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnBnClickedBtapply();
	afx_msg void OnBnClickedBtopenfile();
	afx_msg void OnBnClickedBtkeyboard();
	afx_msg void OnBnClickedBtintpar2();
	afx_msg void OnBnClickedBtcha();
	afx_msg void OnBnClickedBtchb();
};


